package com.darren.framework.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PostRemove;
import javax.persistence.Table;

import org.hibernate.annotations.ResultCheckStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import com.alibaba.fastjson.annotation.JSONField;


@Entity
@Table(name="d_system_parameter")
@SQLDelete(sql = "update d_system_parameter set is_delete = true where id=?", check = ResultCheckStyle.COUNT)
@Where(clause = "is_delete  != true")
public class SystemParameter implements Serializable  {

	private static final long serialVersionUID = 4370220438523741406L;

	@Id
	@Column(name = "id",columnDefinition = "bigint comment '主键d'")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	@Column(name="lookup_cat",columnDefinition = "varchar(80) default '' comment '配置分类名'")
	private String lookupCat;
	
	@Column(name="lookup_type",columnDefinition = "varchar(80) default '' comment '参数名'")
	private String lookupType;
	
	@Column(name="lookup_value",columnDefinition = "varchar(250) default '' comment '参数值'")
	private String lookupValue;
	
	@Column(name="comment",columnDefinition = "varchar(250) default '' comment '参数描述'")
	private String comment;
	
	@JSONField(name="createDate",format="yyyy-MM-dd HH:mm:ss")
	@Column(name="effective_date",columnDefinition = "datetime default CURRENT_TIMESTAMP comment '参数生效时间'")
	private Date effDate;
	
	@JSONField(name="terminatedDate",format="yyyy-MM-dd HH:mm:ss",serialize=false)
	@Column(name="terminated_Date",columnDefinition = "datetime default null comment '参数失效时间'")
	private Date termDate;
	
	 /**
     * 数据状态，是否删除：true是已删除；false 是未删除
     */
    @Column(name = "is_delete",columnDefinition = "tinyint default 0 comment '数据状态，是否删除：true是已删除；false 是未删除'")
	private boolean delete = false;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLookupCat() {
		return lookupCat;
	}

	public void setLookupCat(String lookupCat) {
		this.lookupCat = lookupCat;
	}

	public String getLookupType() {
		return lookupType;
	}

	public void setLookupType(String lookupType) {
		this.lookupType = lookupType;
	}

	public String getLookupValue() {
		return lookupValue;
	}

	public void setLookupValue(String lookupValue) {
		this.lookupValue = lookupValue;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Date getEffDate() {
		return effDate;
	}

	public void setEffDate(Date effDate) {
		this.effDate = effDate;
	}

	public Date getTermDate() {
		return termDate;
	}

	public void setTermDate(Date termDate) {
		this.termDate = termDate;
	}

	public boolean isDelete() {
		return delete;
	}

	public void setDelete(boolean delete) {
		this.delete = delete;
	}
	
	@PostRemove
    public void delete() {
        this.delete = true;
    }
	
}
